/*
    Copyright (C) 2025 mio <stigma@disroot.org>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef PLAYLIST_H
#define PLAYLIST_H

#include <tqobject.h>

#include <kurl.h>

class Playlist : public TQObject
{
	TQ_OBJECT

public:
	explicit Playlist(TQObject *parent = nullptr);
	~Playlist();

	/*! Add a new item */
	void append(const KURL& mrl);
	/*! Append multiple items to the playist. */
	void append(const KURL::List& items);
	/*! Is the playlist empty */
	bool isEmpty() const;
	/*! Returns the number of items in the playlist. */
	int count() const;
	/*! Returns the index of the current item in the playlist. */
	int currentIndex() const;
	/*! Returns the current item in the playlist. */
	KURL currentItem() const;

	/*! The MRL for the item at \p index */
	KURL at(int index) const;

signals:
	/*!
	 * Emitted whenever the playlist index changes.
	 *
	 * \see currentIndex()
	 */
	void currentIndexChanged(int index);
	/*!
	 * Emitted whenever the playlist index changes.
	 *
	 * \see currentItem()
	 */
	void currentItemChanged(const KURL& item);
	void itemsInserted(int start, int end);
	// void itemRemoved(int);

public slots:
	/*! Advance to the next playlist item. */
	void next();
	/*! Return to the previous playlist item. */
	void previous();

private:
	class PlaylistPrivate* d;
};

#endif /* PLAYLIST_H */
